package day16;

public class TestImplementsRunnable {
    public static void main(String[] args) {
        //3.创建接口实现类对象,作为完成业务的目标类
        MyRunnable target = new MyRunnable();
        //4.创建Thread类对象,创建多线程对象
        Thread t1 = new Thread(target);
        Thread t2 = new Thread(target);
        Thread t3 = new Thread(target);
        t1.start();
        t2.start();
        t3.start();
    }
}
//1.自定义线程类
class MyRunnable implements Runnable{
    //2.添加未实现的抽象方法,完成业务
    @Override
    public void run() {
        for (int i = 1; i < 11 ; i++){
            //用已知,释新知
            System.out.println(i+"="+Thread.currentThread().getName());
        }
    }
}